#pragma once
#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
#include<iostream>
#include<assert.h>
#include<string.h>
using namespace std;

namespace xxx
{
	class string
	{
	public:
		/*string()
			:_str(new char[1]{'\0'})
			,_size(0)
			,_capacity(0)
		{}*/

		string(const char* str = "");
		~string();

		const char* c_str() const
		{
			return _str;
		}

		void reserve(size_t n);
		void push_back(char ch);
		void append(const char* str);
		string& operator+=(char ch);
		string& operator+=(const char* str);

		void insert(size_t pos, size_t n, char ch);
		void insert(size_t pos, const char* str);
		void erase(size_t pos = 0, size_t len = npos);

		size_t find(char ch, size_t pos = 0);
		size_t find(const char* str, size_t pos = 0);


	private:
		// 
		char* _str;
		size_t _size;
		size_t _capacity;

		const static size_t npos;
	};

	void test_string1();
	void test_string2();
}